package com.aa.dao;

import com.aa.entity.Adminuser;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;

@Mapper
public interface AdminuserMapper {
    @Select("select * from adminuser where aduName = #{adminuser.aduname} AND aduPwd = #{adminuser.adupwd} ")
    public Adminuser geAdminUser(@Param("adminuser") Adminuser adminuser);

    @Select("select * from adminuser")
    ArrayList<Adminuser> queryAll();

    @Delete("delete from adminuser where aduID = #{aduID}")
    int deleteByID(Integer uID);

    @Select("select * from adminuser where aduID = #{aduID}")
    Adminuser findById(Integer uID);

    //    @Update("UPDATE adminusers SET"+
//            "aduName = #{adminusers.aduname}," +
//            "aduPwd = #{adminusers.adupwd}," +
//            "WHERE aduID =  #{adminusers.aduid}")
    @Update("UPDATE adminuser SET "+
            "aduName = #{adminuser.aduname},"+
            "aduPwd = #{adminuser.adupwd}"+
            "WHERE aduID = #{adminuser.aduid}")
    int update(@Param("adminuser") Adminuser adminuser);

    @Insert("INSERT INTO adminuser(aduName,aduPwd)" +
            "VALUES" +
            "(#{adminuser.aduname},#{adminuser.adupwd})")
    int insert(@Param("adminuser") Adminuser adminuser);

}
